package com.sprouting.personal.model.entity;

import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.sprouting.personal.annotations.CheckLength;
import com.sprouting.personal.annotations.CheckNotNull;
import com.sprouting.personal.model.common.BaseModel;
import com.sprouting.personal.model.common.jsr.AddGroup;
import com.sprouting.personal.model.common.jsr.UpdGroup;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Null;
import java.util.Date;

/**
 * 游戏表
 *
 * @author ：LX（长沙麓谷）
 * @date 创建时间： 2022/9/11 10:25
 */
@Data
@TableName("ps_game")
public class Game extends BaseModel {

    /**
     * 主键
     */
    @TableId
    @CheckNotNull(message = "非法ID", groups = UpdGroup.class)
    @Null(message = "无效ID", groups = AddGroup.class)
    private String id;
    /**
     * 用户ID
     */
    @CheckNotNull(message = "请选择所属用户", groups = UpdGroup.class)
    private String userId;
    /**
     * 游戏类型
     * @see Dict#getId()
     */
    @CheckNotNull(message = "请选择游戏类型")
    private String typeId;
    /**
     * 游戏名
     */
    @CheckLength(min = 1, max = 200, message = "游戏名称超过长度限制")
    @CheckNotNull(message = "请输入游戏名称")
    private String name;
    /**
     * 游戏厂商
     */
    @CheckLength(min = 1, max = 200, message = "游戏厂商信息超过长度限制")
    @CheckNotNull(message = "请输入游戏厂商")
    private String manufacturer;
    /**
     * 简介
     */
    @CheckLength(min = 1, max = 2000, message = "简介信息超过长度限制")
    @CheckNotNull(message = "请输入游戏简介")
    private String briefIntroduction;
    /**
     * 评分-5级
     */
    @NotNull(message = "请对游戏进行评分")
    private Integer grade;
    /**
     * 点评，个人点评
     */
    @CheckLength(max = 2000, message = "点评信息超过长度限制")
    private String comment;
    /**
     * 发行时间
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date releaseTime;
    /**
     * 图标
     */
    @CheckLength(max = 400, message = "游戏封面超过长度限制")
    private String ico;

}
